package com.enation.app.shop.front.api.timetask;

import com.enation.app.shop.core.goods.model.Goods;
import com.enation.app.shop.core.goods.service.IGoodsManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.awt.*;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Component
public class ATaskImpl implements ATask {

    @Autowired
    private IGoodsManager goodsManager;


    @Scheduled(fixedRate=1000)
    @Override
    public void ATask() {
        //System.out.println("test.........");
        List<Map> goodsList=goodsManager.list();
        for (Map map:goodsList){
            String price=map.get("price").toString();
            if (price=="0.0"){
                System.out.println(map.get("name").toString());
                System.out.println(new Date().getTime());
            }
        }
    }
}
